<?php

	require_once('../src/prelude.php');

	$arrClasses = get_declared_classes();
	$arrInterfaces = get_declared_interfaces();
	$arrTypes = array_merge($arrClasses, $arrInterfaces);
	$arrTypes = array_unique($arrTypes);
	sort($arrTypes);

	$sOut = <<<EOF

		<script type="text/javascript">
			
			function toggle(objLink, sClass) {
				
				var objList = document.getElementById('typeList');
				
				if (document.all) {
					
					// for IE and opera
					var sClasses = objList.className;
					var bIsActive = (objLink.className == 'active');

					if (bIsActive) {
						
						objLink.className = '';
						sClasses += ' hide-' + sClass;
					}
					else {
						
						objLink.className = 'active';
						sClasses = sClasses.replace('hide-' + sClass, '');
					}
	
					objList.className = sClasses;
				}
				else {
					
					// for FF
					var sClasses = objList.getAttribute('class');
					var bIsActive = (objLink.hasAttribute('class') && objLink.getAttribute('class') == 'active');
					
					if (bIsActive) {
						
						objLink.removeAttribute('class');
						sClasses += ' hide-' + sClass;
					}
					else {
						
						objLink.setAttribute('class', 'active');
						sClasses = sClasses.replace('hide-' + sClass, '');
					}
	
					objList.setAttribute('class', sClasses);
				}
			}
			
		</script>

		<ul class="options">
			<li><a href="#" onCLick="toggle(this, 'builtin')"       class=""       title="show built in types">B</a></li>
			<li><a href="#" onCLick="toggle(this, 'userdefined')"   class="active" title="show user defined types">U</a></li>
			<li><a href="#" onCLick="toggle(this, 'abstractclass')" class="active" title="show abstract classes">AC</a></li>
			<li><a href="#" onCLick="toggle(this, 'class')"         class="active" title="show classes">C</a></li>
			<li><a href="#" onCLick="toggle(this, 'interface')"     class="active" title="show interfaces">I</a></li>
		</ul>
		
		<h1 class="menu">Types</h1>
			
		<ul id="typeList" class="hide-builtin">
EOF;


	foreach ($arrTypes as $sType) {
		
		$sClass = '';
		$sKind = '';
		if (is_built_in($sType))  { $sKind .= 'B '; $sClass .= 'builtin '; } else { $sKind .= '  '; $sClass .= 'userdefined '; }
		if (is_abstract($sType))  { $sKind .= 'A '; } else { $sKind .= '  '; }
		if (is_class($sType))     { $sKind .= 'C '; } else { $sKind .= '  '; }
		if (is_interface($sType)) { $sKind .= 'I '; $sClass .= 'interface '; } else { $sKind .= '  '; }
		if (is_abstract($sType) && is_class($sType)) { $sClass .= 'abstractclass '; }
		else if (is_class($sType)) { $sClass .= 'class'; }

		$sLink = '<span class="kind">';
		$sLink .= $sKind;
		$sLink .= '</span>';
		$sLink .= '<a href="frames.php?type='. $sType .'" target="frames">'. $sType .'</a>';
		
		$sOut .= "<li class=\"$sClass\">$sLink</li>";
	}

	$sOut .= '</ul><h2 class="legend">Legend</h2><p class="legend">B ... built-in type (class or interface)<br />A ... abstract type (class or interface)<br />C ... class<br />I ... interface</p>';
	
	displayXHTMLDocument('classesNavigationList', $sOut);
	
?>